package demo6;

/**
 * @Author 12629
 * @Description：
 */
public class Test {

    public static void main(String[] args) {
        Student student1 = new Student("zhangsan",3,19);
        Student student2 = new Student("lisi",13,29);

        System.out.println("根据年龄比较：");

        AgeComparator ageComparator = new AgeComparator();

        if(ageComparator.compare(student1,student2) > 0) {
            System.out.println("student1 > student2");
        }else {
            System.out.println("student1 < student2");
        }

        System.out.println("根据分数比较：");

        ScoreComparator scoreComparator = new ScoreComparator();

        if(scoreComparator.compare(student1,student2) > 0) {
            System.out.println("student1 > student2");
        }else {
            System.out.println("student1 < student2");
        }

        System.out.println("根据姓名比较：");

        NameComparator nameComparator = new NameComparator();
        if(nameComparator.compare(student1,student2) > 0) {
            System.out.println("student1 > student2");
        }else {
            System.out.println("student1 < student2");
        }

    }






    public static void main1(String[] args) {
        Student student1 = new Student("zhangsan",3,19);
        Student student2 = new Student("lisi",13,29);

        if(student1.compareTo(student2) > 0) {
            System.out.println("student1 > student2");
        }else {
            System.out.println("student1 < student2");
        }

        /*if(student1 > student2) {
            System.out.println("student1 > student2");
        }else {
            System.out.println("student1 < student2");
        }*/


        /*int a = 10;
        int b = 20;
        if(a > b) {
            System.out.println("a > b");
        }else {
            System.out.println("a < b");
        }*/
    }
}
